package com.my.security.config;

import com.my.security.interceptor.SecurityHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author lbb
 * @fileName InterceptorConfig
 * @description 拦截器配置，
 * WebMvcConfigurerAdapter已过时，
 * 使用继承WebMvcConfigurationSupport或者实现WebMvcConfigurer
 *
 * @date 2020/5/12 17:30
 */
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport{
    /**
     * 配置自定义拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new SecurityHandlerInterceptor()).addPathPatterns("/resource/**");
    }
}
